(function($){
	// 构造器
	$.fn.abdiComponent = function(type,typeid,format){
		function component(){
		};
		if(type == 1 || type == 2){ // 当行单选题、单行多选题
			component.prototype = $.fn.abdiChoice();
		}else if(type == 6){
			if(typeid == 5){
				component.prototype = $.fn.abdiText();
			}
		}else{
			component.prototype = $.fn.abdiComponent;
		}
		var question = new component();
		return question;
	};
	// 默认值
	$.fn.abdiComponent.defaults = {
			
	};
	// 初始化 问题模型
	$.fn.abdiComponent.init = function(question){
		//alert(question.description);
		this.data = $.extend({},this.defaults,question);
		//this.getQuestionDesc = loadQuestionDesc(question);
		//alert(this.getQuestionDesc);
	};
	
	// 显示问题
	$.fn.abdiComponent.show = function(){
		var data = this.data;
		var container = getEmptyDiv('question', data.type + '_' + data.typeid + '_' + data.questionuuid);
		var questionTitle = getEmptyDiv('question-tit')
		var questionTitleLeft = getEmptyDiv('question-titleft')
				 .append($('<div class="text-q-num">Q'+ data.sortindex +'.</div>'))
				 .append($('<div class="text-q-con">'+ getQuestionDesc(data) +'</div>'))
				 .append(getEmptyDiv('clear'));
		container.append(questionTitle.append(questionTitleLeft));
		container.append(getEmptyDiv('clear'));
		return container;
	};
	
	// 获取问题描述
	function getQuestionDesc(question){
		return (typeof question.descriptionview != 'string' || question.descriptionview == '') ? question.description : question.descriptionview;
	};
	
	// 填写答案
	$.fn.abdiComponent.fillAnswer = function(){
	};
})(jQuery);